﻿/*
 * Copyright 2010 Pieter De Rycke
 *
 * This file is part of Frozen Bubble XNA.
 *
 * Frozen Bubble XNA is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2, as published by the Free Software Foundation.
 *
 * Frozen Bubble XNA is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with Frozen Bubble XNA. If not, see 
 * <http://www.gnu.org/licenses/>.
 *
 * Artwork:
 *    Alexis Younes <73lab at free.fr>
 *      (everything but the bubbles)
 *    Amaury Amblard-Ladurantie <amaury at linuxfr.org>
 *      (the bubbles)
 *
 * Soundtrack:
 *    Matthias Le Bidan <matthias.le_bidan at caramail.com>
 *      (the three musics and all the sound effects)
 *
 * Design & Programming:
 *    Guillaume Cottenceau <guillaume.cottenceau at free.fr>
 *      (design and manage the project, whole Perl sourcecode)
 *
 * XNA and Windows Phone 7 port:
 *    Pieter De Rycke
 *
 * Websites:
 *    http://www.frozen-bubble.org/
 *    http://pieterderycke.wordpress.com/
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FrozenBubble
{
    public enum GameState { Game, Lost, Won}

    public class BubbleConstants
    {
#if WINDOWS_PHONE
        public const double LAUNCHER_SPEED = 0.06;	        // speed of rotation of launchers
        public const double TARGET_ANIM_SPEED = 40;         // number of milliseconds that should last between two animation frames
        public const double BUBBLE_SPEED = 20;		        // speed of movement of launched bubbles
        public const double MALUS_BUBBLE_SPEED = 60;	    // speed of movement of "malus" launched bubbles
        public const double BUBBLE_SIZE = 32.0 * (4.0 / 3.0);
        public const double FREE_FALL_CONSTANT = 1.0;
#else
        public const double LAUNCHER_SPEED = 0.03;	        // speed of rotation of launchers
        public const double TARGET_ANIM_SPEED = 20;         // number of milliseconds that should last between two animation frames
        public const double BUBBLE_SPEED = 10;		        // speed of movement of launched bubbles
        public const double MALUS_BUBBLE_SPEED = 30;	    // speed of movement of "malus" launched bubbles
        public const double BUBBLE_SIZE = 32.0;
        public const double FREE_FALL_CONSTANT = 0.5;
#endif

        public const int CANON_ROTATIONS_NB = 40;           // number of rotations of images for canon (should be consistent with gfx/shoot/Makefile)

        public const int TIMEOUT_PINGUIN_SLEEP = 200;
        

        public const double ROW_SIZE = BUBBLE_SIZE * (7.0 / 8.0);

        public static int Even(int number)
        {
            if (number % 2 == 0)
                return 1;
            else
                return 0;
        }

        public static int Odd(int number)
        {
            if (number % 2 == 1)
                return 1;
            else return 0;
        }

        public static int Odd(double number)
        {
            return (((int)number) % 2 == 1) ? 1 : 0;
        }

        public static bool ToBool(int i)
        {
            return i != 0;
        }

        public static int ToInt(bool b)
        {
            return (b) ? 1 : 0;
        }
    }
}
